package interviewClassic150;

public class IsSubsequence {
    public boolean isSubsequence(String s, String t) {
        //两个指针分别遍历s和t
        int i = 0;
        int j = 0;
        int m = s.length();
        int n = t.length();

        while (i < m && j < n) {
            char sCur = s.charAt(i);
            char tCur = t.charAt(j);

            if (tCur == sCur) i++;
            j++;
        }

        if (i == m) return true;
        return false;
    }
}
